﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace agvcontroller.Common
{
    public enum enumJobState
    {
        ABORT,
        CANCEL,
        PAUSE,
        CREATE,
        QUEUED,
        SENDJOB,
        ACCEPTJOB,
        MOVEINGTOSOURCE,
        ARRIVEDTOSOURCE,
        ACQUIRESTART,
        ACQUIREEND,
        MOVINGTODEST,
        ARRIVEDTODEST,
        REMOVESTART,
        REMOVEEND,
        COMPLETED,
        
    }

    public enum enumJobType
    {
        Transfer,
        Parking,
        Charging,
    }

    public enum enumConnect
    {
        CONNECTION,
        DISCONNECTION,
    }
    public class enumConnectString
    {
        public static string ConvertString(enumConnect value)
        {
            string str = "unknown";
            switch (value)
            {
                case enumConnect.CONNECTION:
                    str = "CONNECTION";
                    break;
                case enumConnect.DISCONNECTION:
                    str = "DISCONNECTION";
                    break;
            }
            return str;
        }
    }


    public enum enumCommnication
    {
        ONLINE,
        OFFLINE,
    }
    public class enumCommnicationString
    {
        public static string ConvertString(enumCommnication value)
        {
            string str = "unknown";
            switch (value)
            {
                case enumCommnication.ONLINE:
                    str = "ONLINE";
                    break;
                case enumCommnication.OFFLINE:
                    str = "OFFLINE";
                    break;
            }
            return str;
        }
    }

    public enum enumContolState
    {
        RUN,
        IDLE,
        DOWN,
        CHARGER,
    }
    public class enumContolStateString
    {
        public static string ConvertString(enumContolState value)
        {
            string str = "unknown";
            switch (value)
            {
                case enumContolState.RUN:
                    str = "RUN";
                    break;
                case enumContolState.IDLE:
                    str = "IDLE";
                    break;
                case enumContolState.DOWN:
                    str = "DOWN";
                    break;
                case enumContolState.CHARGER:
                    str = "CHARGER";
                    break;
            }
            return str;
        }
    }

    public enum enumOperation
    {
        AUTO,
        MANUAL,
    }
    public class enumOperationString
    {
        public static string ConvertString(enumOperation value)
        {
            string str = "unknown";
            switch (value)
            {
                case enumOperation.AUTO:
                    str = "AUTO";
                    break;
                case enumOperation.MANUAL:
                    str = "MANUAL";
                    break;
            }
            return str;
        }
    }

    public enum enumCrossDirect
    {
        EAST,
        WEST,
        SOUTH,
        NORTH,
    }
    public class enumCrossDirectString
    {
        public static string ConvertString(enumCrossDirect value)
        {
            string str = "unknown";
            switch (value)
            {
                case enumCrossDirect.EAST:
                    str = "EAST";
                    break;
                case enumCrossDirect.WEST:
                    str = "WEST";
                    break;
                case enumCrossDirect.SOUTH:
                    str = "SOUTH";
                    break;
                case enumCrossDirect.NORTH:
                    str = "NORTH";
                    break;
            }
            return str;
        }
    }

    public enum enumService
    {
        ONMAP,
        EXITMAP,
    }
    public class enumServiceString
    {
        public static string ConvertString(enumService value)
        {
            string str = "unknown";
            switch (value)
            {
                case enumService.ONMAP:
                    str = "ONMAP";
                    break;
                case enumService.EXITMAP:
                    str = "EXITMAP";
                    break;
            }
            return str;
        }
    }

    public enum enumVehicleDirect
    {
        FORWARD,
        LEFT,
        RIGHT,
        BACKWARD,
    }
    public class enumVehicleDirectString
    {
        public static string ConvertString(enumVehicleDirect value)
        {
            string str = "unknown";
            switch (value)
            {
                case enumVehicleDirect.FORWARD:
                    str = "FORWARD";
                    break;
                case enumVehicleDirect.LEFT:
                    str = "LEFT";
                    break;
                case enumVehicleDirect.RIGHT:
                    str = "RIGHT";
                    break;
                case enumVehicleDirect.BACKWARD:
                    str = "BACKWARD";
                    break;
            }
            return str;
        }

        public static enumVehicleDirect ConvertEnum(string value)
        {
            enumVehicleDirect enumValue = enumVehicleDirect.FORWARD;
            switch (value)
            {
                case "FORWARD":
                    enumValue = enumVehicleDirect.FORWARD;
                    break;
                case "LEFT":
                    enumValue = enumVehicleDirect.LEFT;
                    break;
                case "RIGHT":
                    enumValue = enumVehicleDirect.RIGHT;
                    break;
                case "BACKWARD":
                    enumValue = enumVehicleDirect.BACKWARD;
                    break;
            }
            return enumValue;
        }
    }

    public enum enumAction
    {
        NONE,
        MOVE,
        LOAD,
        UNLOAD,
        EXCHANGE,
        CHARGE,
        PARKING,
    }
    public class enumActionString
    {
        public static string ConvertString(enumAction value)
        {
            string str = "unknown";
            switch (value)
            {
                case enumAction.MOVE:
                    str = "MOVE";
                    break;
                case enumAction.LOAD:
                    str = "LOAD";
                    break;
                case enumAction.UNLOAD:
                    str = "UNLOAD";
                    break;
                case enumAction.EXCHANGE:
                    str = "EXCHANGE";
                    break;
                case enumAction.CHARGE:
                    str = "CHARGE";
                    break;
                case enumAction.PARKING:
                    str = "PARKING";
                    break;
                case enumAction.NONE:
                    str = "NONE";
                    break;
                default:
                    str = "unknown";
                    break;

            }
            return str;
        }

        public static enumAction ConvertEnum(string value)
        {
            enumAction enumValue = enumAction.NONE;
            switch (value)
            {
                case "NONE":
                    enumValue = enumAction.MOVE;
                    break;
                case "MOVE":
                    enumValue = enumAction.MOVE;
                    break;
                case "LOAD":
                    enumValue = enumAction.LOAD;
                    break;
                case "UNLOAD":
                    enumValue = enumAction.UNLOAD;
                    break;
                case "EXCHANGE":
                    enumValue = enumAction.EXCHANGE;
                    break;
                case "CHARGE":
                    enumValue = enumAction.CHARGE;
                    break;
                case "PARKING":
                    enumValue = enumAction.PARKING;
                    break;
            }
            return enumValue;
        }
    }

    public enum enumVehicleDriver
    {
        SERIAL,
        SOCKET,
        HSMS,
    }

    public enum enumEjectType
    {

    }

    public enum enumCommnicationType
    {
    }

    public class enumCommnicationTypeString
    {
        public static string ConvertString(enumCommnicationType value)
        {
            string str = "unknown";
            //switch (value)
            //{
            //    case enumCommnicationType.FORWARD:
            //        str = "FORWARD";
            //        break;
            //    case enumCommnicationType.LEFT:
            //        str = "LEFT";
            //        break;
            //    case enumCommnicationType.RIGHT:
            //        str = "RIGHT";
            //        break;
            //    case enumCommnicationType.BACKWARD:
            //        str = "BACKWARD";
            //        break;
            //}
            return str;
        }

        //public static enumCommnicationType ConvertEnum(string value)
        //{
        //    enumCommnicationType result = enumCommnicationType.FORWARD;
        //    switch (value)
        //    {
        //        case "FORWARD":
        //            result = enumCommnicationType.FORWARD;
        //            break;
        //        case "LEFT":
        //            result = enumCommnicationType.LEFT;
        //            break;
        //        case "RIGHT":
        //            result = enumCommnicationType.RIGHT;
        //            break;
        //        case "BACKWARD":
        //            result = enumCommnicationType.BACKWARD;
        //            break;
        //    }
        //    return result;
        //}
    }


    public enum enumGuideType
    {
    }


    public class enumEjectTypeString
    {
        public static string ConvertString(enumEjectType value)
        {
            return "";
        }
    }

    public struct stVehicleInfo
    {
        public bool Power;
        public bool MotorStart;
        public bool EStop;
        public bool Break;
    }


    public class CCommonInfo
    {
        public static CEjectType EjectType = new CEjectType();
        public static CCommType CommType = new CCommType();
        public static CGuideType GuideType = new CGuideType();
        public static CActionType ActionType = new CActionType();

        public CCommonInfo()
        {

        }
    }
}
